package com.doris.lucene;

import java.util.List;

/**
 * 分页
 * 
 * @author root
 *
 */
public class Pager {

	/**
	 * 记录总数
	 */
	private int total;
	/**
	 * 一页记录
	 */
	private List<LuceneDocument> results;

	/**
	 * 分页
	 * 
	 * @param total 总数
	 * @param results 当前页记录
	 */
	public Pager(int total, List<LuceneDocument> results) {
		this.total = total;
		this.results = results;
	}

	public int getTotal() {
		return total;
	}

	public void setTotal(int total) {
		this.total = total;
	}

	public List<LuceneDocument> getResults() {
		return results;
	}

	public void setResults(List<LuceneDocument> results) {
		this.results = results;
	}

	/**
	 * 获取总页数
	 * 
	 * @return 总页数
	 */
	public int getTotalPages() {
		return (this.getTotal() - 1) / Constants.NUM_PER_PAGE + 1;
	}

}
